import axios from 'axios';
import router from '../router';
const request = axios.create({
    // baseURL: 'http://39.100.7.70:81/',
    // withCredentials: true,
    timeout: 5000
});
request.interceptors.request.use(config=>{
    return config
},error => {
    router.push({path:"/error"});
    return Promise.reject(error)
});
//响应拦截器
request.interceptors.response.use(config=>{
    return config
},error => {
    console.log("error----->",error);
    router.push({path:"/error"});
    return Promise.reject(error)
});
export default request



//TS语法 interface接口
// export interface AxiosInterceptorManager<V> {
//     use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: any) => any): number;
// eject(id: number): void;
// }